#include "stdafx.h"
#include "./luascope.h"

Scope::Scope(Registration* pReg)
: m_pReg(pReg)
{
}

Scope::~Scope()
{
    delete m_pReg;
    m_pReg = NULL;
}

const Scope& Scope::operator,(const Scope& scope) const
{
    Registration* pReg = m_pReg;
    while (pReg->next)
    {
        pReg = pReg->next;
    }
    pReg->next = scope.m_pReg;
    return *this;
}

void Scope::Register(lua_State* luaState, bool bGlobal) const
{
	if (m_pReg)
	{
		m_pReg->Register(luaState, bGlobal);
	}
}